package cn.com.zpark.servlet_request;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @PackageName: cn.com.zpark.servlet_request
 * @ClassName: ServletRequestDemo03
 * @Description:
 * @author: RZS
 * @date: 2021/11/13  15:43
 */
@WebServlet("/srd3.do")
public class ServletRequestDemo03 extends HttpServlet {
    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // 解决请求乱码问题
        request.setCharacterEncoding("utf-8");
        // 获取表单数据
        String username = request.getParameter("username");
        String password = request.getParameter("password");
        System.out.println(username+": "+password);
        response.getWriter().write("<h1>"+username+": "+password+"</h1>");
    }
}
